﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace DARE.Save.DataStructures
{
    public class CIsoCameraData: CCameraData
    {
        public bool Smooth;
        public float SmoothAmount;
        public Vector3 FollowPosition;
        public string FollowNode;
        public Vector3 FollowLookAtOffset;
        public float Zoom;
        public float ZoomMin;
        public float ZoomMax;


        public override void FillDataStructure(object cam)
        {
            base.FillDataStructure(cam);
            CIsoCamera camera = cam as CIsoCamera;
            Smooth = camera.Smooth;
            SmoothAmount = camera.SmoothAmount;
            FollowPosition = camera.FollowPosition;
            if (camera.FollowNode != null)
                FollowNode = camera.FollowNode.Name;
            FollowLookAtOffset = camera.FollowLookAtOffset;
            Zoom = camera.Zoom;
            ZoomMax = camera.ZoomMax;
            ZoomMin = camera.ZoomMin;
        }

        public override void FillFromDataStructure(out object camera, params object[] paramsData)
        {
            base.FillFromDataStructure(out camera);
            (camera as CIsoCamera).Smooth = Smooth;
            (camera as CIsoCamera).SmoothAmount = SmoothAmount;
            (camera as CIsoCamera).FollowPosition = FollowPosition;
            if (paramsData.Length > 0 && (paramsData[0] is CRender3D) && FollowNode != null)
                (camera as CIsoCamera).FollowNode = (paramsData[0] as CRender3D).GetNode(FollowNode);
            (camera as CIsoCamera).FollowLookAtOffset = FollowLookAtOffset;
            (camera as CIsoCamera).Zoom = Zoom;
            (camera as CIsoCamera).ZoomMax = ZoomMax;
            (camera as CIsoCamera).ZoomMin = ZoomMin;
        }

        public override CCamera CreateInstance()
        {
            return new CIsoCamera(Name);
        }
    }
}
